package com.xmg.p2p.base.controller;

import com.xmg.p2p.base.interceptor.RequireLogin;
import com.xmg.p2p.base.util.JSONResult;
import com.xmg.p2p.business.service.IBidRequestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * lcd  2020/5/28
 * Description:前台用户投标接口
 */
@Controller
public class BidController {
    @Autowired
    private IBidRequestService bidRequestService;

    @RequireLogin
    @RequestMapping
    @ResponseBody
    public JSONResult bid(long bidRequestId,int amount){
        try {
            bidRequestService.bid(bidRequestId, amount);
            return new JSONResult();
        } catch (RuntimeException e) {
            return new JSONResult(false,e.getMessage());
        }

    }
}
